home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-04-02 | 1.3 KB | 78 lines | [TEXT/MPS ] |
- program drag;
- {$D}
- USES {$LOAD pinterfaces.dump}
- MemTypes,QuickDraw,OsIntf,PasLibIntf,ToolIntf,
- PackIntf,IntEnv,CursorCtl,
- {$LOAD}
- Drag;
-
- const
- whichpict = 128;
-
- var
- myPic : PicHandle;
- myRect : Rect;
- mainoldPort: GrafPtr;
- inc,
- x,y,xinc,yinc,
- temp,
- start,
- finish : integer;
- xyPt : point;
-
- begin{main}
- InitGraf(@thePort);
- GetWMgrPort( mainoldPort );
- SetPort( mainoldPort );
-
- ClipRect( screenBits.bounds );
- myPic := PicHandle(GetResource('PICT', whichPict));
-
- InitCursor;
- repeat until button;
- repeat until not button;
-
- InitDrag( myPic );
- GetMouse(xyPt);
- xinc := xyPt.h;
- yinc := xyPt.v;
- y := yinc;
- x := xinc;
- repeat
- GetMouse(xyPt);
- if xinc > 0 then xinc := xyPt.h else xinc := -xyPt.h;
- if yinc > 0 then yinc := xyPt.v else yinc := -xyPt.v;
- x := x + xinc;
- y := y + yinc;
- if y < screenBits.bounds.top then
- begin
- y := screenBits.bounds.top;
- yinc := -yinc;
- end
- else if y > screenBits.bounds.bottom then
- begin
- y := screenbits.bounds.bottom;
- yinc := -yinc;
- end;
- if x < screenBits.bounds.left then
- begin
- x := screenBits.bounds.left;
- xinc := -xinc;
- end
- else if x > screenBits.bounds.right then
- begin
- x := screenBits.bounds.right;
- xinc := -xinc;
- end;
- SetPt( xyPt, x, y );
- DragItTo( xyPt );
- SystemTask;
- CleanIt;
- until button;
-
- TidyUpDrag;
- ShowCursor;
-
- IEExit(0);
- end.
-